package cn.zhaoyun.dao;

import cn.zhaoyun.entity.Emp;
import org.apache.ibatis.annotations.*;

@Mapper
public interface EmpDao {
    @Insert(" INSERT INTO t_emp (name, salary) VALUES (#{id}, #{salary}) ")
    void insert(Emp emp);

    @Select(" SELECT e.id, e.name, e.salary FROM t_emp e WHERE e.id = #{id} ")
    Emp selectById(long id);

    @Update(" UPDATE t_emp SET name = #{name}, salary = #{salary} WHERE id = #{id} ")
    void update(Emp emp);

    @Delete(" DELETE FROM t_emp WHERE id = #{id} ")
    void deleteById(long id);

    @Select(" SELECT e.id, e.name, e.salary FROM t_emp e WHERE e.name = #{name} ")
    Emp selectByName(String name);
}
